import Vue from 'vue'
import Router from 'vue-router'

import homeRouters from '@/router/home/home'
import loginAndRegistryRouters from '@/router/loginAndRegistry/loginAndRegistry'
import personalCentre from '@/router/personalCentre/personalCentre'
import videoRouters from '@/router/video/chamVideo'
import tougaoRouters from '@/router/tougao/chamTougao'
import fanjuRouters from '@/router/fanju/fanju'
import dianshijuRouters from '@/router/dianshiju/dianshiju'
import dianyingRouters from '@/router/dianying/dianying'
import yinyueRouters from '@/router/yinyue/yinyue'
import zhaiwuRouters from '@/router/zhaiwu/zhaiwu'
import zongyiRouters from '@/router/zongyi/zongyi'
import asmrRouters from '@/router/asmr/asmr'
import dianzigejiRouters from '@/router/dianzigeji/dianzigeji'
import jilupianRouters from '@/router/jilupian/jilupian'
import shengyouRouters from '@/router/shengyou/shengyou'

Vue.use(Router)


const baseRoutes = [];
//合并两个路由
const routes = baseRoutes.concat(homeRouters, loginAndRegistryRouters, personalCentre,videoRouters,tougaoRouters,fanjuRouters,dianshijuRouters,dianyingRouters,yinyueRouters,zhaiwuRouters,
    zongyiRouters,asmrRouters,dianzigejiRouters,jilupianRouters,shengyouRouters);

/**
 * 解决同路由跳转报错的vue的bug!
 * @type {{(location: RawLocation): Promise<Route>; (location: RawLocation, onComplete?: Function, onAbort?: ErrorHandler): void}}
 */
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}

export default new Router({
  //mode:'history',
  routes
})

